package com.estar.integaration.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.estar.integaration.Mapper.AcodeProductVoMapper;
import com.estar.integaration.Service.IAcodeProductVoService;
import com.estar.integaration.entity.AcodeProductVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Author: YJL
 * Date: 2021/11/22 11:07
 **/
@Service
public class AcodeProductVoServiceImpl extends ServiceImpl<AcodeProductVoMapper, AcodeProductVo> implements IAcodeProductVoService {

  @Autowired
  AcodeProductVoMapper acodeProductVoMapper;

  @Override
  public void insert(AcodeProductVo acodeProductVo) {
    acodeProductVoMapper.insert(acodeProductVo);
  }

  @Override
  public AcodeProductVo selectByfullAcode(String fullAcode) {
    QueryWrapper queryWrapper = new QueryWrapper();
    queryWrapper.eq("full_a_code",fullAcode);
    List<AcodeProductVo> acodeProductVoList = acodeProductVoMapper.selectList(queryWrapper);
    if(acodeProductVoList.size() > 0){
      return acodeProductVoList.get(0);
    }else {
      return null;
    }
  }


}
